#region Using directives
using System;
using System.Collections.Generic;
#endregion

namespace SharpWind.Helpers
{
	public class GarbageManager : IDisposable
	{
		private List<IDisposable> disposables = new List<IDisposable>();

		public void Add( IDisposable disposable )
		{
			this.disposables.Add( disposable );
		}

		public void Dispose()
		{
			foreach( IDisposable disposable in this.disposables )
			{
				disposable.Dispose();
			}

			this.disposables.Clear();
			GC.Collect();
		}
	}
}
